//
//  LRHomeTitleButton.swift
//  LRWeibo
//
//  Created by 雷路荣 on 15/12/20.
//  Copyright © 2015年 leilurong. All rights reserved.
//

import UIKit

class LRHomeTitleButton: UIButton {
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    init(title: String){
        //frame先设置CGRectZero 后面sizeToFit后就有值了
        super.init(frame: CGRectZero)
        setTitle(title, forState: UIControlState.Normal)
        setImage(UIImage(named: "navigationbar_arrow_down"), forState: UIControlState.Normal)
        setTitleColor(UIColor.blackColor(), forState: UIControlState.Normal)
        sizeToFit()
    }
    override func layoutSubviews() {
        super.layoutSubviews()
        titleLabel?.frame.origin.x = 0
        imageView?.frame.origin.x = (titleLabel?.frame.size.width)!+3
    }
    

}
